<template>
    <van-tabbar route>
        <van-tabbar-item icon="home-o" to="/">Home</van-tabbar-item>
        <van-tabbar-item icon="cart-o" to="/cart">Cart</van-tabbar-item>
        <van-tabbar-item icon="user-o" :to="path">{{text}}</van-tabbar-item>
    </van-tabbar>
</template>

<script setup lang='ts'>
import { ref, computed } from 'vue';
import { useUserStore } from '@/store/userStore'
const user = useUserStore()
//动态切换登录和未登陆的文字
const text = computed(() => {
    return user.userid ? 'User' : 'Login'
})
//动态切换跳转的路径
   const path = computed(() => {
      return user.userid?'/user':'login'
})
</script>

<style scoped lang='scss'>

</style>
